const { contentTracing } = require("electron");

// 此模块不包括 Web 界面, 并且只能在 ready 完成后才可使用
const handleTraceMainPerformance = async () => {
	await contentTracing.startRecording({
		included_categories: ["*"],
	});
	console.log("Tracing started");

	// 等待 5 秒钟以收集足够的数据
	await new Promise((resolve) => setTimeout(resolve, 5000));
	
	const path = await contentTracing.stopRecording();
	console.log("追踪数据记录到： " + path);
};

module.exports = {
	handleTraceMainPerformance,
};
